#!/bin/bash

set +e

rm -f fabc
ebpf=$(go list -m -f '{{.Dir}}' github.com/cilium/ebpf)
export ebpf_headers=$ebpf/examples/headers

if [ -f "vmlinux.h" ]
then
    echo vmlinux.h already exist.
else
    bpftool btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h
    echo vmlinux.h generated.
fi

go generate
go build .

./fabc
